﻿using System.Linq;
using System.IO;
using System.Security.Policy;
using MongoDB.Driver;
using NetFluid;
using Sito.model;
using Sito.Model;

namespace Sito
{
    [Route("/testmongo")]
    internal class Database : FluidPage
    {
        private static MongoServer server; // connect to localhost
        private static MongoDatabase db;

        public static MongoCollection<User> User;
        public static MongoCollection<News> News;
        public static MongoCollection<Wiki> Wiki;
        public static MongoCollection<Stat> Stat;
        public static MongoCollection<Bug> Bug;

        public override void OnServerStart()
        {
            server = MongoServer.Create(); // connect to localhost
            db = server.GetDatabase("test");

            User = db.GetCollection<User>("user");
            News = db.GetCollection<News>("news");
            Wiki = db.GetCollection<Wiki>("wiki");
            Stat = db.GetCollection<Stat>("stat");
            Bug = db.GetCollection<Bug>("bug");
        }

        public override void Main()
        {
            
        }
    }
}